#include<iostream>
#include<vector>
using namespace std;

#include <unordered_map>
class Solution {
public:

    int MoreThanHalfNum_Solution(vector<int>& numbers)
    {
        unordered_map<int, int> mp;
        for (int i = 0; i < numbers.size(); i++)
        {
            mp[numbers[i]]++;
            if (mp[numbers[i]] > numbers.size() / 2)
                return numbers[i];
        }
        return 0;
    }
};


int main()
{
    vector<int> arr{ 1,2,3,2,2,2,5,4,2 ,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3};
    Solution s;
    cout<<s.MoreThanHalfNum_Solution(arr);
    return 0;
}